#! /bin/bash
export LANG=zh_CN.UTF-8
HIVE_HOME=/usr/bin/hive

${HIVE_HOME} -S -e "
-- 分区
--动态分区配置
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;
set hive.exec.max.dynamic.partitions.pernode=10000;
set hive.exec.max.dynamic.partitions=100000;
set hive.exec.max.created.files=150000;
--hive压缩
set hive.exec.compress.intermediate=true;
set hive.exec.compress.output=true;
--写入时压缩生效
set hive.exec.orc.compression.strategy=COMPRESSION;



-- 插入课程【维度表】
insert overwrite table edu_dwd.dwd_DT_course_table_upload_detail partition (dt)
select
    id,
    base_id,
    class_id,
    class_date,
    content,
    teacher_id,
    teacher_name,
    job_number,
    classroom_id,
    classroom_name,
    is_outline,
    class_mode,
    is_stage_exam,
    is_pay,
    tutor_teacher_id,
    tutor_teacher_name,
    tutor_job_number,
    is_subsidy,
    answer_teacher_id,
    answer_teacher_name,
    answer_job_number,
    remark,
    create_time,
    dt
from edu_ods.ods_course_table_upload_detail;


-- 插入作息时间【维度表】
insert overwrite table edu_dwd.dwd_DT_tbh_class_time_table partition (dt)
select
    id,
    class_id,
    morning_template_id,
    morning_begin_time,
    morning_end_time,
    afternoon_template_id,
    afternoon_begin_time,
    afternoon_end_time,
    evening_template_id,
    evening_begin_time,
    evening_end_time,
    use_begin_date,
    use_end_date,
    dt
from edu_ods.ods_tbh_class_time_table;


-- 插入班级学生人数【维度表】
insert overwrite table edu_dwd.dwd_DT_class_studying_student_count partition (dt)
select
    id,
    school_id,
    subject_id,
    class_id,
    studying_student_count,
    studying_date,
    dt
from edu_ods.ods_class_studying_student_count;
"